<?php

namespace App\Http\Middleware;

use App\Exceptions\BasicException;
use Closure;

class StopServerMiddleware
{
    public function handle($request,Closure $next){
        $stop_server_time = env('STOP_SERVER_TIME');
        if (!empty($stop_server_time) && time() > $stop_server_time) {
            throw new BasicException(0, '服务器已停止运营');
        }
        return $next($request);
    }
}